<template>
	<view>
		<!-- 拒签合同 -->
		<uni-popup ref="refusePopup" background-color="#fff" type="dialog" class="refuse_dialog">
			<uni-popup-dialog type="info" cancelText="取消" confirmText="拒签" title="您确认要拒签合同吗？"
				@confirm="dialogConfirm" @close="dialogClose">
				<view class="text_item">
					<view>温馨提醒：</view>
					<span>1、合同内容如有异议，您可以点击【拒签】按钮，通知发起方。</br>
					2、合同拒签后，您仍然可以点击【确认签署】按钮，完成签署。</span></view>
				<uni-easyinput type="textarea" v-model="rejectReason" placeholder="请填写拒签原因，向其他签署方（含发起方）说明情况，最多输入100字"></uni-easyinput>	
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	import {insertCacheRefuseContract,updateContractReject} from "@/api/ec/work/contract/contractSign";
	export default {
		data() {
			return {
				rejectReason:'',//拒签原因
			}
		},
		methods: {
			openDialog(id){
				this.$refs.refusePopup.open('center')
				this.id = id
			},
			/** 关闭 */
			// dialogClose(){
			// 	this.$refs.refusePopup.close()
			// 	this.$emit("cancel",'')
			// },
			/** 拒签 */
			dialogConfirm(){
				this.$modal.loading();
				// 拒签状态 13
				updateContractReject({
				  id: this.id,
				  isReject: 1,
				  status: this.$enums.contract_sign_flow_status.REJECT,
				  rejectReason: this.rejectReason
				}).then((response) => {
				  uni.hideLoading()
				  // 拒签时间放置缓存
				  insertCacheRefuseContract(this.id);
				  this.$emit("ok",'')
				  setTimeout(()=>{
				  	this.$modal.msgSuccess('拒签成功！')
				  },300)
				});     
			},
		}
	}
</script>

<style scoped lang="scss">
	.text_item{
		line-height: 40rpx;
		span{
			margin: 10rpx 0 20rpx;
			display: block;
			color: #666;
			font-size: 26rpx;
		}
	}
	::v-deep .uni-popup .uni-popup__wrapper{
		width: 90%;
	}
	::v-deep .uni-dialog-content{
		display: block;
		padding: 30rpx 40rpx;
	}

</style>
